from playwright.sync_api import sync_playwright

"""
测试窗口最大化
"""
with sync_playwright() as p:
    browser = p.chromium.launch(headless=False, slow_mo=1000, args=["--start-maximized"]) # 显示启动浏览器，停顿2秒
    context = browser.new_context(no_viewport=True) # 禁用窗口大小
    page = context.new_page()
    page.goto("http://127.0.0.1:34009/xxl-job-admin/toLogin")
    print(page.title()) # 打印当前页面title

    context.close() # 关闭上下文
    browser.close() # 关闭浏览器